<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<!-- <script>
					//    去掉一个数组的重复元素
					var arr = [1, 2, 3, 4, 5, 2, 3, 4];
					var newArr = [];
					for (var i = 0; i < arr.length; i++) {
						var bool = true;
						//每次都要判断新数组中是否有旧数组中的值。
						for (var j = 0; j < newArr.length; j++) {
							if (arr[i] === newArr[j]) {
								bool = false;
							}
						}
						if (bool) {
							newArr[newArr.length] = arr[i];
						}
					}
					console.log(newArr);
				</script> -->
				<script>
				function chongfu(arr){
				var newArr = [];
				for (var i = 0; i < arr.length; i++) {
					var bool = true;
					//每次都要判断新数组中是否有旧数组中的值。
					for (var j = 0; j < newArr.length; j++) {
						if (arr[i] === newArr[j]) {
							bool = false;
						}
					}
					if (bool) {
						newArr[newArr.length] = arr[i];
					}
				}
				return newArr;
				}
				var arr =chongfu( [1, 2, 3, 4, 5, 2, 3, 4]);
				console.log(arr);
				</script>
	</head>
	<body>
	</body>
</html>
